load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "importer",
    srcs = [
        "chunk_process.go",
        "engine_process.go",
        "import.go",
        "job.go",
        "kv_encode.go",
        "precheck.go",
        "table_import.go",
    ],
    importpath = "github.com/pingcap/tidb/executor/importer",
    visibility = ["//visibility:public"],
    deps = [
        "//br/pkg/lightning/backend",
        "//br/pkg/lightning/backend/encode",
        "//br/pkg/lightning/backend/kv",
        "//br/pkg/lightning/backend/local",
        "//br/pkg/lightning/checkpoints",
        "//br/pkg/lightning/common",
        "//br/pkg/lightning/config",
        "//br/pkg/lightning/log",
        "//br/pkg/lightning/mydump",
        "//br/pkg/lightning/verification",
        "//br/pkg/storage",
        "//br/pkg/streamhelper",
        "//br/pkg/utils",
        "//config",
        "//ddl/util",
        "//executor/asyncloaddata",
        "//expression",
        "//kv",
        "//meta/autoid",
        "//parser",
        "//parser/ast",
        "//parser/format",
        "//parser/model",
        "//parser/mysql",
        "//parser/terror",
        "//planner/core",
        "//sessionctx",
        "//sessionctx/stmtctx",
        "//sessionctx/variable",
        "//table",
        "//table/tables",
        "//tablecodec",
        "//types",
        "//util",
        "//util/chunk",
        "//util/dbterror",
        "//util/dbterror/exeerrors",
        "//util/etcd",
        "//util/filter",
        "//util/intest",
        "//util/logutil",
        "//util/sqlexec",
        "//util/stringutil",
        "//util/syncutil",
        "@com_github_docker_go_units//:go-units",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_pingcap_log//:log",
        "@com_github_tikv_client_go_v2//config",
        "@com_github_tikv_client_go_v2//tikv",
        "@com_github_tikv_client_go_v2//util",
        "@com_github_tikv_pd_client//:client",
        "@org_golang_x_sync//errgroup",
        "@org_uber_go_multierr//:multierr",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "importer_test",
    timeout = "short",
    srcs = [
        "import_test.go",
        "job_test.go",
        "precheck_test.go",
        "table_import_test.go",
    ],
    embed = [":importer"],
    flaky = True,
    race = "on",
    shard_count = 14,
    deps = [
        "//br/pkg/errors",
        "//br/pkg/lightning/config",
        "//br/pkg/lightning/mydump",
        "//br/pkg/streamhelper",
        "//br/pkg/utils",
        "//config",
        "//expression",
        "//infoschema",
        "//kv",
        "//parser",
        "//parser/ast",
        "//parser/model",
        "//planner/core",
        "//testkit",
        "//util/dbterror/exeerrors",
        "//util/etcd",
        "//util/logutil",
        "//util/mock",
        "//util/sqlexec",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_pingcap_log//:log",
        "@com_github_stretchr_testify//require",
        "@com_github_tikv_client_go_v2//util",
        "@io_etcd_go_etcd_client_v3//:client",
        "@io_etcd_go_etcd_server_v3//embed",
        "@org_uber_go_zap//:zap",
    ],
)
